VFG.Event=function(viewer){
	this.viewer=viewer;
	this.init();
}

/**
 * 初始化
 */
VFG.Event.prototype.init=function(){
	var _this=this;
	_this.handler = new Cesium.ScreenSpaceEventHandler(_this.viewer.scene.canvas);
	_this.handler.setInputAction(function (movement) {
		if(_this.LEFT_CLICK){
			_this.LEFT_CLICK(movement);
		}
    },Cesium.ScreenSpaceEventType.LEFT_CLICK)
    
	_this.handler.setInputAction(function (movement) {
		if(_this.MOUSE_MOVE){
			_this.MOUSE_MOVE(movement);
		}
    },Cesium.ScreenSpaceEventType.MOUSE_MOVE )   
    
    
	_this.handler.setInputAction(function (movement) {
		if(_this.RIGHT_CLICK){
			_this.RIGHT_CLICK(movement);
		}
    },Cesium.ScreenSpaceEventType.RIGHT_CLICK)    
    
    
	_this.handler.setInputAction(function (movement) {
		if(_this.LEFT_DOWN){
			_this.LEFT_DOWN(movement);
		}
    },Cesium.ScreenSpaceEventType.LEFT_DOWN) 
    
	_this.handler.setInputAction(function (movement) {
		if(_this.MIDDLE_DOWN){
			_this.MIDDLE_DOWN(movement);
		}
    },Cesium.ScreenSpaceEventType.MIDDLE_DOWN)  
     
}

VFG.Event.prototype.on=function(EventType,FUNC){
	if('LEFT_CLICK'==EventType){
		this.LEFT_CLICK=FUNC
	}
	if('MOUSE_MOVE'==EventType){
		this.MOUSE_MOVE=FUNC
	}
	if('RIGHT_CLICK'==EventType){
		this.RIGHT_CLICK=FUNC
	}
	if('LEFT_DOWN'==EventType){
		this.LEFT_DOWN=FUNC
	}
	if('MIDDLE_DOWN'==EventType){
		this.MIDDLE_DOWN=FUNC
	}
}

VFG.Event.prototype.remove=function(EventType){
	if('LEFT_CLICK'==EventType){
		this.LEFT_CLICK=null
	}
	if('MOUSE_MOVE'==EventType){
		this.MOUSE_MOVE=null
	}
	if('RIGHT_CLICK'==EventType){
		this.RIGHT_CLICK=null
	}
}



VFG.Event.prototype.destroy=function(){
	var _this = this;
	if(_this.LEFT_CLICK){
		_this.LEFT_CLICK=null;
		delete this.LEFT_CLICK
	}
	if(_this.MOUSE_MOVE){
		_this.MOUSE_MOVE=null;
		delete this.MOUSE_MOVE
	}
	if(_this.RIGHT_CLICK){
		_this.RIGHT_CLICK=null;
		delete this.RIGHT_CLICK
	}
	if(_this.handler){
		_this.handler.destroy();
		delete this.handler
	}
	delete this.viewer
	return Cesium.destroyObject(this);
}
